package com.wrapper.param;

import com.alibaba.fastjson.annotation.JSONField;
import com.wrapper.core.param.ParamField;
import com.wrapper.core.param.ParamFields;
import lombok.Data;

import java.util.Date;

@Data
public class OrderResponse {

    private String orderNo;

    @ParamField("address")
    private Address orderAddress;

    @ParamFields({
            @ParamField(value = "product1", group = Group1.class),
            @ParamField(value = "product2", group = Group2.class)
    })
    private Product product;

    private String remark;

    @ParamField("createTime")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createDate;

    @Data
    public static class Address {
        private String province;
        private String city;
        private String address;
    }

    @Data
    public static class Product {
        @ParamFields({
                @ParamField(value = "name", group = Group1.class),
                @ParamField(value = "prdDescription", group = Group2.class)
        })
        private String productName;
        @ParamFields({
                @ParamField(value = "quantity", group = Group1.class),
                @ParamField(value = "quantity", group = Group2.class)
        })
        private Integer productCount;
        private Double weight;
    }


    public interface Group1 {
    }

    public interface Group2 {
    }

}
